//
//  ViewController.m
//  unityadsiOSdemo
//
//  Created by peac on 2025/9/28.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.testMode = true;
    [UnityAds
         initialize:@"5895518"
         testMode:self.testMode
         initializationDelegate:self];
}
 
// Implement initialization callbacks to handle success or failure:
#pragma mark : UnityAdsInitializationDelegate
- (void)initializationComplete {
    NSLog(@" - UnityAdsInitializationDelegate initializationComplete" );
    // Pre-load an ad when initialization succeeds, so it is ready to show:
    [UnityAds load:@"Interstitial_iOS" loadDelegate:self];
}
 
- (void)initializationFailed:(UnityAdsInitializationError)error withMessage:(NSString *)message {
    NSLog(@" - UnityAdsInitializationDelegate initializationFailed with message: %@", message );
}
 
// Implement load callbacks to handle success or failure after initialization:
#pragma mark: UnityAdsLoadDelegate
- (void)unityAdsAdLoaded:(NSString *)placementId {
    NSLog(@" - UnityAdsLoadDelegate unityAdsAdLoaded %@", placementId);
    [UnityAds show:self placementId:@"Interstitial_iOS" showDelegate:self];

}
 
- (void)unityAdsAdFailedToLoad:(NSString *)placementId
                     withError:(UnityAdsLoadError)error
                   withMessage:(NSString *)message {
    NSLog(@" - UnityAdsLoadDelegate unityAdsAdFailedToLoad %@", placementId);
}


- (void)unityAdsShowClick:(nonnull NSString *)placementId { 
    
}

- (void)unityAdsShowComplete:(nonnull NSString *)placementId withFinishState:(UnityAdsShowCompletionState)state { 
    
}

- (void)unityAdsShowFailed:(nonnull NSString *)placementId withError:(UnityAdsShowError)error withMessage:(nonnull NSString *)message { 
    
}

- (void)unityAdsShowStart:(nonnull NSString *)placementId { 
    
}



@end
